#ifndef SHOWPLATFORM_H
#define SHOWPLATFORM_H

#include <QMainWindow>

#include <QStack>

#include"node.h"
#include"edge.h"
#include"myscene.h"
namespace Ui {
class showPlatform;
}

class showPlatform : public QMainWindow
{
    Q_OBJECT

public:
    explicit showPlatform(QWidget *parent = nullptr);
    ~showPlatform();
    int start,end;
    QTimer *timer;
    qreal speed=1;
    bool isDragging=0;
    int curIndex=-1;//遍历时当前的节点编号
    QList<Node*> nodes;
    QList<Edge*> edges;

    QStack<int> path;

    int size=50;//节点大小，默认长宽50像素
    int curID=-1;//鼠标选中当前节点id

    Edge * edge;
    MyScene * scene;

    QString algorithm_name="Dijkstra";//算法名称,默认迪杰斯特拉
    void scene_init();
    void view_init();
    void connect_init();
    void styleInit();
    void ShowMessgae(QString s);//打印信息
    void DJPro();//算法
    void DJ();
    void bellman_ford();
    void spfa();
    void showPath();
    void spfaPro();

private:
    Ui::showPlatform *ui;
private slots:
    void on_mousePress(QMouseEvent *e);
    void on_mouseRelease(QMouseEvent *e);
    void on_mouseMove(QMouseEvent *e);
    void on_open_but_clicked();
    void on_set_s_but_clicked();
    void on_set_e_but_clicked();
    void on_play_but_clicked();
    void on_stop_but_clicked();
    void on_big_but_clicked();
    void on_small_but_clicked();
    void on_horizontalSlider_sliderMoved(int position);
    void on_comboBox_activated(const QString &arg1);
    void on_reset_but_clicked();
};

#endif // SHOWPLATFORM_H
